Page({
    data: {
        banner: [],
        brandList: [],
        categoryList: [],
        channel: [],
        hotGoodsList: [],
        newGoodsList: [],
        topicList: []
    },

    // 定义请求方法
    async initData() {
        // 2.1 发起网络请求  wx:request({url:"地址"，method:"请求方式"，success:成功回调，fail:失败回调，complete:完成回调})
        const data = await wx.$http.get("/index/index")
        Object.keys(data).forEach(key => {
            this.setData({
                [key]: data[key]
            })
        })

    },
    onLoad(options) {

        this.initData()

    },
    onShow() {
        console.log(this.getTabBar());
        const tabBar = this.getTabBar()
        tabBar.setData({
            currentPath: "pages/index/index"
        })
    },
})